Skip to content

Conversation

mai93
Copy link
Contributor

@mai93 mai93 commented Oct 17, 2025

These updates are mainly needed for compatibility with bazel 9:

  • Update version of rules_cc to 0.2.10 to fix the cyclic dependency error while testing with bazel 9 pre-release
  • Update version of protobuf to 33.0 which has load statements for rules_cc needed for bazel 9

Copy link
Collaborator

@rickeylev rickeylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed an update to the changelog.

Please update the PR description to explain why these bumps were necessary.

Mostly LGTM, sans the question and need to create deps.bzl function

py_repositories()

# Needed for rules_cc 0.2.10
load("@bazel_features//:deps.bzl", "bazel_features_deps")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of copy/pasting this same setup to every downstream workspace, create a second setup function and load and call that.

python/repositories_deps.bzl

which does the 4 lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried having a file load_cc_deps.bzl that looks like this:

load("@bazel_features//:deps.bzl", "bazel_features_deps")
load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")

def add_cc_deps():
  bazel_features_deps()
  compatibility_proxy_repo()

but it did not work:

ERROR: Failed to load Starlark extension '@@bazel_features_version//:version.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.

because bazel_features_deps() call needs to happen before the load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo") and we cannot have load statements in starlark functions, or what you're suggesting is different?

- "--noenable_bzlmod"
- "--build_tag_filters=-integration-test"
# recent abseil-cpp requires C++17 which is not used by default in Bazel 7
- "--cxxopt=-std=c++17"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain a bit more about this? I'm guessing this is coming from protobuf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, for protobuf 33.0 (and its dependency abseil-cpp) C++17 is the minimum supported version (https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)

I'm trying to add these flags to make it work with Bazel 7 but it is not straightforward as it is still failing for tests on windows (https://buildkite.com/bazel/rules-python-python/builds/13428#0199f84a-0a7c-4ed7-8b30-6ab8ef898f71) where -std=c++17 is not recognized. Do you have any suggestions for that?

@mai93 mai93 marked this pull request as ready for review October 20, 2025 17:29
@aignas
Copy link
Collaborator

aignas commented Oct 21, 2025

Playing devil's advocate. This will be a breaking change for bazel 7 users who rely on protobuf. Should we cut a rules_python 2 where we remove protobuf dep instead? We can still merge the PR, but we could do a lightweight version 2 release with cleaning a few things up afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants